package org.boyan.common.util.jsonschema.validate;

import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.Map;
import org.boyan.common.util.jsonschema.CommonProperty;

/**
 * @author: zhuxiaobao
 * @time: 2021/9/24 16:00
 */

public class PopupProperty extends CommonProperty {
    private static final long l = -3200493311633999539L;

    private String m;

    private String n;

    private String o;

    private Boolean p;

    public String getCode() {
        return this.m;
    }

    public void setCode(String code) {
        this.m = code;
    }

    public String getDestFields() {
        return this.n;
    }

    public void setDestFields(String destFields) {
        this.n = destFields;
    }

    public String getOrgFields() {
        return this.o;
    }

    public void setOrgFields(String orgFields) {
        this.o = orgFields;
    }

    public Boolean getPopupMulti() {
        return this.p;
    }

    public void setPopupMulti(Boolean popupMulti) {
        this.p = popupMulti;
    }

    public PopupProperty() {}

    public PopupProperty(String key, String title, String code, String destFields, String orgFields) {
        this.e = "popup";
        this.b = "string";
        this.a = key;
        this.f = title;
        this.m = code;
        this.n = destFields;
        this.o = orgFields;
        this.p = Boolean.valueOf(true);
    }

    @Override
    public Map<String, Object> getPropertyJson() {
        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("key", getKey());
        JSONObject jSONObject = getCommonJson();
        if (this.m != null) {
            jSONObject.put("code", this.m);
        }
        if (this.n != null) {
            jSONObject.put("destFields", this.n);
        }
        if (this.o != null) {
            jSONObject.put("orgFields", this.o);
        }
        jSONObject.put("popupMulti", this.p);
        hashMap.put("prop", jSONObject);
        return (Map)hashMap;
    }
}

